home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Dir / dir.xpack < prev    next >
Text File  |  1999-04-21  |  6KB  |  206 lines

  1. G4C
  2.  
  3. ;
  4. ; April '97 by Brian Jones
  5. ; XPK packing and unpacking gui for D. Keletsekis' Dir.gc
  6. ;
  7. ; This gui needs xpack (from the XPK distribution in the c drawer)
  8. ; in C:
  9. ; Passwords are supported but not well trapped, if something won't
  10. ; unpack it probably needs a password (but it won't tell you).
  11. ; Also, not all xpk sub-libraries support password encoding so
  12. ; if you are trying to apply a password and it won't work the 
  13. ; sub-library probably can't use one.
  14. ;
  15.  
  16. WINBIG -1 11 486 174   "Choose Packer -- Reload to get new files"
  17. WinType 11110001
  18. nofontsense
  19. varpath dir.gc
  20.  
  21. xOnLoad
  22. xid = $$lv.id
  23. xdir = $$lv.dir
  24. gosub dir.xpack startup1                  ;load the listviews
  25. gosub dir.xpack startup
  26. run 'resident c:xpack pure add'
  27.  
  28. xOnReload                       
  29. xid = $$lv.id
  30. xdir = $$LV.DIR
  31. gosub dir.xpack startup1           
  32. gosub dir.xpack startup
  33.  
  34. xOnClose
  35. GuiQuit dir.xpack
  36.  
  37. xOnQuit                           ;cleanup
  38. run 'resident xpack remove'
  39.  
  40. ;The Listviews
  41. ;-------------------------------------------------------------
  42. XLISTVIEW 174 19 160 129  "" rawcmprsr "LIBS:Compressors" 0 DIR   ;see note
  43. GadID 1                                                           ;below
  44.  
  45. XLISTVIEW 5 16 150 146    "" cmprsr "" 0 TXT
  46. GadID 2
  47. update dir.xpack 4 $cmprsr
  48.  
  49. XLISTVIEW 161 32 320 131  "" xfile "" 10 MULTI
  50. GadID 3
  51.  
  52. ;The Gadgets
  53. ;------------------------------------------------------
  54. TEXT 3 1 150 13  "RAKE" 100 BOX
  55. GadID 4
  56.  
  57. XHSLIDER 54 159 64 12  "Mode?" xmode 0 100 100 "%ld%%"
  58. GadID 5
  59.  
  60. XCYCLER 161 1 80 13  "" xchoice
  61. GadID 6
  62. CStr Pack pack
  63. CStr Unpack unpack
  64. gosub dir.xpack makegui
  65.  
  66. XBUTTON 404 1 77 13  "GO!"
  67. GadID 7
  68. lvuse dir.xpack 3
  69. lvgo #0
  70. xfile = $$lv.rec
  71. xcount = 1
  72. if $xchoice = pack
  73.    appvar cmprsr '.'
  74.    appvar cmprsr $xmode
  75. endif
  76. if $xpass = ""
  77.     psswrd = ""
  78. else
  79.     psswrd = PASSWORD
  80. endif
  81. guiwindow dir.xpack wait
  82. xpercent == $xcount * 100
  83. xpercent == $xpercent / $xfilecount
  84. update dir.xpack 10 $xpercent
  85. Launch 1 'xpack $xfile $xmthd $cmprsr $psswrd $xpass ALL QUIET'
  86.  
  87. XBUTTON 324 1 77 13        "CANCEL"
  88. GadID 8
  89. guiClose dir.xpack
  90.  
  91. XBUTTON 244 1 77 13        "Reload"
  92. GadID 9
  93. xid  = $$lv.id           
  94. xdir = $$LV.DIR
  95. lvuse dir.xpack 3
  96. lvclear
  97. gosub dir.xpack startup
  98.  
  99. GAUGE 162 158 319 13  IN RIDGE 2 0 0
  100. GadID 10 
  101.  
  102. XTEXTIN 244 16 157 14  "Password " xpass "" 100
  103. GadID 11
  104.  
  105. ;-----------------------------------------------------------
  106. xOnReturn 1                 ;continuation of processing if there is more     
  107. lvuse dir.xpack 3           ;than one file.
  108. counter xcount inc 1
  109. if $xcount <= $$lv.total     ; not the end of the lv
  110.       xpercent == $xcount * 100
  111.       xpercent == $xpercent / $xfilecount
  112.       update dir.xpack 10 $xpercent
  113.       lvgo next  
  114.       xfile = $$lv.rec
  115.       Launch 1 'xpack $xfile $xmthd $cmprsr $psswrd $xpass ALL QUIET'
  116. else
  117. guiwindow dir.xpack resume
  118. update dir.xpack 10 0
  119. setwintitle dir.xpack 'Finished - Choose new files or quit'
  120. lvuse dir.gc $xid
  121. lvdir refresh
  122. endif
  123.  
  124. ;--------------------------------------------------------------
  125. xroutine startup                ;setup of the list of files to be packed
  126. setscreen dir.xpack $*SCREEN    ;or unpacked
  127. xfilecount = 0
  128. lvuse dir.gc $xid
  129. lvmulti first
  130. if $lv_file = ""
  131.    ezreq "How's about choosing\nsome files first ?" 'Oh yeah..' ""
  132.    stop
  133. endif
  134. while $lv_file > ""
  135.   extract lv_file ext tempinf
  136.     if $tempinf != ".info"         ;;this is a filter for .info files so
  137.       counter xfilecount inc 1      ;they won't be packed and become
  138.       lvuse dir.xpack 3             ;unreadable
  139.       lvadd $lv_file
  140.       lvuse dir.gc $xid
  141.     endif
  142.   lvmulti next
  143. endwhile
  144. setgad dir.xpack 1 HIDE
  145. guiopen dir.xpack
  146.  
  147. xRoutine startup1               ;set up of the list of xpk sub-libraries.
  148. xchoice = pack                  ;this expects a normal xpk installation
  149. xmthd = METHOD                  ;(Libs:Compressors) if not, change the 
  150. cmprsr = RAKE                   ;place that listview 1 looks for the
  151. xmode = 100                     ;sub-libraries (see listviews section
  152. psswrd = ""                     ;above) 
  153. xpass = ""
  154. lvuse dir.xpack 2
  155. lvclear
  156. LVuse dir.xpack 1               
  157. LVdir all                       
  158. lvmulti first                    
  159. while $rawcmprsr > ""             
  160.    tempcmp = $$LV.REC
  161.    cutvar tempcmp CUT CHAR 3 dummy1
  162.    cutvar tempcmp CUT CHAR -8 dummy2
  163.    lvuse dir.xpack 2
  164.    lvadd $tempcmp
  165.    lvuse dir.xpack 1
  166.    lvmulti next
  167. endwhile
  168.  
  169. xroutine makegui                   ;this could be easier if I put the
  170. if $xchoice = pack                 ;xpk libraries list on the right
  171.    setgad dir.xpack 2 show         ;instead of the left but I like
  172.    setgad dir.xpack 4 show         ;it better that way
  173.    setgad dir.xpack 5 show
  174.    changearg dir.xpack 3 0 161
  175.    changearg dir.xpack 6 0 161
  176.    changearg dir.xpack 7 0 404
  177.    changearg dir.xpack 8 0 324
  178.    changearg dir.xpack 9 0 244
  179.    changearg dir.xpack 10 0 162
  180.    changearg dir.xpack 11 0 244
  181.    changegad dir.xpack 0 -1 11 486 174 ""
  182.    setwintitle dir.xpack "Choose Packer -- Reload to get new files"
  183.    xmthd = METHOD                 ;reset some stuff now that we're back in
  184.    xmode = 100                    ;pack mode
  185.    update dir.xpack 5 100
  186.    if $cmprsr = ""
  187.       cmprsr = RAKE
  188.    endif
  189. else
  190.    setgad dir.xpack 2 hide
  191.    setgad dir.xpack 4 hide
  192.    setgad dir.xpack 5 hide
  193.    changearg dir.xpack 3 0 2
  194.    changearg dir.xpack 6 0 2
  195.    changearg dir.xpack 7 0 245
  196.    changearg dir.xpack 8 0 165
  197.    changearg dir.xpack 9 0 85
  198.    changearg dir.xpack 10 0 4
  199.    changearg dir.xpack 11 0 85
  200.    changegad dir.xpack 0 -1 11 326 174 ""
  201.    setwintitle dir.xpack "Unpack -- Reload for new files"
  202.    xmthd = ""           ;these are not needed in decompress mode
  203.    cmprsr = ""          ;
  204. endif
  205. redraw dir.xpack
  206.